<!--Main Contents Starts-->
<div id="contents">
	<section class="left listings">
    	<h1><?=$sidebarName;?></h1>
       <article>
       <?php
	   	$total=count($items);
		$end= ceil($total/2);
       ?>
        	<span class="group-left">
		        <ul>
                <?php 
					for($i=0; $i<$end; $i++): 
					if($sidebarLst=="regions"):
				?>
		        	<li><a href="?page=listings&cityID=<?=$items[$i]['cityID']?>"><?=$items[$i]['cityName']?></a></li>
				<?php else: ?>
		        	<li><a href="?page=listings&catID=<?=$items[$i]['categoryID']?>"><?=$items[$i]['categoryName']?></a></li>
    			<?php 
					endif;
					endfor; 
				?>
		        </ul>
            </span>
            
            <span class="group-right">
		        <ul>
				<?php 
					for(; $i<count($items); $i++): 
					if($sidebarLst=="regions"):
				?>
		        	<li><a href="?page=listings&cityID=<?=$items[$i]['cityID']?>"><?=$items[$i]['cityName']?></a></li>
				<?php else: ?>
		        	<li><a href="?page=listings&catID=<?=$items[$i]['categoryID']?>"><?=$items[$i]['categoryName']?></a></li>
    			<?php 
					endif;
					endfor; 
				?>
		        </ul>
            </span>
            <a href="alert('Man at Work!')" class="change-city">Change City</a>
    		<div class="height_increaser"></div><!-- Just to increase height automatically -->
        </article>
    </section>
    
	<section class="center listings-center">
    	<?php
			if(isset($cityID)) $url="?page=listings&cityID=".$cityID; else $url="?page=listings&catID=".$catID;
		?>
    
    	<h4>Monday 17 October <span>See ads by: <a href="<?=$url."&sort=date"?>">Date added</a> | <a href="<?=$url."&sort=price"?>">Price</a></span></h4>

        <ul>
			<?php foreach($ads as $ad): ?>
        	<li class="feature-listing">
                <img src="images/ads/<?=$ad['adImage']?>" alt="" title="Listing Item" width="88" height="68" />
            	<span class="detail">
        			<p class="heading-title"><a href="alert('Man at Work!')"><?=$ad['adTitle']?></a></p>
        			<p class="location"><?=$ad['cityName']?></p>
        		</span>
                
                <?php if($ad['isFeatured']==1): ?>
        		<span class="feature">Featured Ad <img src="images/help-icon.png" alt="" title="Listings Title" /></span>
        		<?php endif; ?>
                
                <span class="price">&pound;<?=$ad['price']?><br />
                <a href="<?=$url?>&sort=<?=$sort?>&sub=addToFavorites&aid=<?=$ad['adID']?>">
                <img src="images/star-icon.png" alt="Add To Favorites" title="Add To Favorites" /></a>		
                </span>
    		<div class="height_increaser"></div><!-- Just to increase height automatically -->
            </li>
            <?php endforeach; ?>
        </ul>
    </section>
	
    <section class="right">
    	<article></article>
    	<article></article>
    </section>
    <div class="height_increaser"></div><!-- Just to increase height automatically -->
</div>
<!--Main Contents Ends-->

